#!/usr/bin/python3
from flask import Flask

from package.db import DB
from package.utils import set_log_handler
from package.router import init as routerInit
from package.config import init as configInit

app = Flask(__name__)
# app.config["MQTT_CLIENT_ID"] = 'admin'
app.config['MQTT_BROKER_URL'] = '116.198.227.244'
app.config['MQTT_BROKER_PORT'] = 1883
app.config['MQTT_USERNAME'] = None
app.config['MQTT_PASSWORD'] = None
app.config['MQTT_REFRESH_TIME'] = 1.0  # refresh time in seconds

Config = configInit()

# log = set_log_handler(app.logger, Config)

DataBase = DB(Config.DBConfig)

routerInit(app, DataBase)